/*****************************************************************
This is an abstract base class for NCUs in the NCUC model.
The common interfaces of NCUs are defined in this ABC.
An object, m_currentSill, is used to maintain 
the value of the current value of the sill of a NCU.
#Caution!!!!!
Users shall assign the parameters of a NCU of all types after the 
configuration of the NCU is determined.
Date of Modification: 14/06/2006 (dd/mm/yyyy)
******************************************************************/
#pragma once
#ifndef _GeneralNCU
#define _GeneralNCU
#include "CVSequence.h"
#include "GenomeType.h"
#include "NCUGenomeSet.h"
#include "Misc.h"
#include "NCULabel.h"
#include <string>
#include <utility>
class GeneralNCU
{
public:
	/*********************************************
	Configuration Section
	*********************************************/
	// get the number of parameters of a NCU
	virtual const unsigned int number() const = 0;
	// get the type and number of the composite vents of a NCU
	const string configString() const;
	/*********************************************
	Composite vent Section
	*********************************************/
	// assign the number of composite vent in a NCU
	virtual void nSequence(const unsigned int num) = 0;
	// get the number of composite vents
	virtual unsigned int nSequence() const = 0;
	// reset the status of a NCU
	virtual void reset() = 0;
	/*********************************************
	Parameters Section
	*********************************************/
	// assign all parametrs of a NCU
	virtual bool parameters(const vector<double> &paras) = 0;
	// get all parameters of a NCU
	virtual vector< double> parameters() const = 0;
	// virtual constructor
	virtual GeneralNCU* clone() const = 0;
	// setting up the genome configurations
	void sillUpper(const double upper);
	void sillLower(const double lower);
	void sillLength(const unsigned int dits);
	void ventLength(const unsigned int dits);
	// get the genome information
	virtual vector<const GenomeType*> genome() const = 0;
	const NCUGenomeSet& genomeSet() const;
	// simulation
	virtual outputPair simulation(const double &input) = 0;
	virtual ~GeneralNCU();
protected:
	// constructors
	GeneralNCU();
	GeneralNCU(const char &id, const unsigned int &config);
	explicit GeneralNCU(const char &id);
	GeneralNCU(const GeneralNCU &rhs);
	GeneralNCU& operator=(const GeneralNCU& rhs);
	/*********************************************
	Composite vent Section
	*********************************************/
	// assign composite vents' parameters
	virtual bool sequence(const vector<double> &paras) = 0;
	// get composite vents' parameters
	virtual const CVSequence& sequence() const = 0;
	/*********************************************
	Initial Sill Section
	*********************************************/	
	// assign the value of the initial sill
	virtual void initialSill(const double &IS) = 0;
	// get the value of the initial sill
	virtual const double& initialSill() const = 0;
	// calculate the output of the lateral vents
	virtual double output(const double &input) = 0;
	// calculate the output of the imtermediate vents
	virtual double bottom(const double &input) = 0;
protected:
	NCULabel m_label;
private:
	//bool _firstSimulated;
	NCUGenomeSet m_genomeSet;
};
#endif